package org.tcs.com.service;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Service;

@Service
public class MailServiceImpl implements MailService {

	private SimpleMailMessage mailMessage;
	private JavaMailSenderImpl mailSender;
	private Logger logger = LoggerFactory.getLogger(MailServiceImpl.class);

	/**
	 * @param mailMessage
	 */
	@Autowired
	public MailServiceImpl(SimpleMailMessage mailMessage,
			JavaMailSenderImpl mailSender) {
		this.mailSender = mailSender;
		this.mailMessage = mailMessage;
	}

	@Override
	public boolean sendMail(List<String> toMail, List<String> cc,
			List<String> bcc) {
		// TODO Auto-generated method stub
		return false;
	}

	private void someMethodWhchActuallysendsthemail() {

	}

	public void mailTester() {
		mailMessage.setTo("gaddam.1987@gmail.com");
		mailMessage.setText("Test mail from spring mail");
		mailMessage.setSubject("Test mail");
		try {
			mailSender.send(mailMessage);
		} catch (Exception e) {
			logger.warn("problem in sending mail", e);

		}
	}

}
